package apiday02;

public class RegDemo10 {
    public static void main(String[] args) {
        /*
         *测试  如何匹配 域名www.tedu.cn
         * 必须使用正则表达式www\\.tedu\\.cn
         * . 表示任意字符
         * 如果匹配点就需要\\.
         */

        String reg1 = "www.tedu.cn";     //错误
        String reg2 = "www\\.tedu\\.cn"; //正确
        String s1 = "www.tedu.cn";
        String s2 = "wwwAteduAcn";
        String s3 = "www-tedu-cn";
        //测试reg1
        System.out.println(s1.matches(reg1));
        System.out.println(s2.matches(reg1));
        System.out.println(s3.matches(reg1));

        System.out.println("---------------");
        //测试reg2
        System.out.println(s1.matches(reg2));
        System.out.println(s2.matches(reg2));
        System.out.println(s3.matches(reg2));

    }
}
